package cn.cmvideo.springboot.poms.listener;

import java.util.Date;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.stereotype.Component;

@Component
public class Listener1002861 implements MessageListener
{
	ExecutorService executor = Executors.newFixedThreadPool(10);

	// private int count = 0;

	@Override
	public void onMessage(Message message)
	{
		// count++;
		// System.out.println("消费>>>>>>>>>>>>" + count + "--" +
		// DateFormatUtils.format(new Date(), "yyyy-MM-dd HH：mm：ss:SSS"));
		try
		{
			System.out.println("1002861，接收线程..." + Thread.currentThread().getName() + "收到的消息是："
					+ ((TextMessage) message).getText());
		} catch (JMSException e)
		{
			e.printStackTrace();
		}
		// executor.execute(() -> {
		// try
		// {
		// System.out.println("1002861，接收线程..." +
		// Thread.currentThread().getName() + "收到的消息是："
		// + ((TextMessage) message).getText());
		// } catch (JMSException e)
		// {
		// e.printStackTrace();
		// }
		// });
	}
}
